#include "client.h"

int recvCycle(int socketfd,void *buf,size_t len)
{
    char *p = (char *)buf;//因为后边recv有指针的加操作，所以这里指针的基类型要转换成char*！
    unsigned long total = 0;
    int ret;
    while(total != len)
    {
        ret = recv(socketfd,p+total,len - total,0);//这里注意第二个参数是p+total！！！也就是接着上一次的地方往后写！！不然就错了！
        ERROR_CHECK(ret,-1,"recv in recvCycle");
        total+=ret;
        loadingBar(total,len);
    }
    printf("\n");
    return 0;
}

